package com.deparse.dpframe.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class DPSharedPreferenceUtil {
    private SharedPreferences sp;

    public DPSharedPreferenceUtil(Context applicationContext, String path) {
        this.sp = applicationContext.getSharedPreferences(path, Context.MODE_APPEND);
    }

    public DPSharedPreferenceUtil(Context applicationContext, String path, int mode) {
        this.sp = applicationContext.getSharedPreferences(path, mode);
    }

    public void write(String key, String value) {
        SharedPreferences.Editor ed = sp.edit();
        ed.putString(key, value);
        ed.commit();
    }

    public String get(String key, String defaultValue) {
        return sp.getString(key, defaultValue);
    }
}
